﻿<%@ Page Title="" Language="C#" MasterPageFile="~/LTR/MlyLtrMaster.Master" AutoEventWireup="true" CodeBehind="MyAlerts.aspx.cs" Inherits="MLY.LTR.MyAlerts" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>


<asp:Content ID="Content1" ContentPlaceHolderID="titleHolder" runat="server">
<script language="javascript" type="text/javascript">
        
        window.onload = function() {
            $("#my_alertsmenuitem").addClass('active');
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="content">
    <div id="topbuttons">
        <asp:Button ID="NewAlertButton" runat="server"  Text="<%$ Dict:Alerts.CreateAlert %>" PostBackUrl="~/LTR/CreateAlert.aspx"
          CssClass="SC_Button SC_FloatLeft" />
        <asp:Button ID="AlertDefinitionsButton" runat="server" Text="Alert definitions" PostBackUrl="~/LTR/Alerts.aspx"
         CssClass="SC_Button SC_FloatLeft" />
        <asp:Button ID="DeleteSelectedButton" runat="server" CssClass="SC_BottonGrey SC_FloatRight" OnClick="DeleteSelected"
         OnClientClick="return confirm('Are you sure that you want to delete the selected alerts?')" Text="Delete selected" />
                    
    </div>
    <div class="clr"></div>
    <br />
    <asp:GridView ID="AlertsGrid" runat="server" AutoGenerateColumns="false" DataSourceID="UserAlertsDataSource" Width="100%"
     AllowPaging="true" PageSize="20" GridLines="Both"  >
    <PagerSettings Mode="NumericFirstLast" LastPageImageUrl="~/Images/Icons/Next.png"
     PreviousPageImageUrl="~/Images/Icons/Prev.png" NextPageImageUrl="~/Images/Icons/Next.png"
     PageButtonCount="7" Position="Bottom" FirstPageImageUrl="~/Images/Icons/Prev.png"  />
    <PagerStyle CssClass="pagination" HorizontalAlign="Left" />
    
    <HeaderStyle CssClass="SC_grid_header"  />
    <RowStyle CssClass="SC_grid_cell"  />
    <Columns>
        <asp:BoundField HeaderText="Alert name" DataField="AlertName" ItemStyle-Width="15%"  />
        <asp:BoundField HeaderText="Date created" DataField="DateAlertCreated" ItemStyle-Width="15%"/>
        <asp:TemplateField HeaderText="System field / condition" ItemStyle-Width="20%">
        <ItemTemplate>Update</ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Work order" ItemStyle-Width="30%">
        <ItemTemplate>
            <asp:Literal ID="WoLiteral" runat="server" Text='<%# Eval("CustomerWorkOrderNumber").ToString() + ", " + Eval("ContractorWorkOrderNumber").ToString() %>'></asp:Literal>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:HyperLinkField NavigateUrl="~/LTR/Inventory.aspx" HeaderText="Link to orders" Text="Link to orders" ItemStyle-Width="10%" />
        <asp:TemplateField HeaderText="Critical" ItemStyle-Width="5%"><ItemTemplate>NO</ItemTemplate></asp:TemplateField>
        <asp:TemplateField HeaderText="select" ItemStyle-Width="5%" >
            <ItemTemplate>
                <asp:HiddenField ID="MarkingIdHiddenField" runat="server" Value='<%# Eval("MarkingId") %>' />                        
                <asp:CheckBox ID="SelectBox" runat="server" ToolTip="Select to close this alert" />
                <ajax:ToggleButtonExtender ID="SelectBoxToggleButtonExtender1" runat="server" CheckedImageUrl="~/Images/Icons/CheckBoxChecked.png"
                     UncheckedImageUrl="~/Images/Icons/CheckBoxUnChecked.png" CheckedImageAlternateText="Checked" UncheckedImageAlternateText="Unchecked"
                      TargetControlID="SelectBox" ImageWidth="21" ImageHeight="20"  ></ajax:ToggleButtonExtender>
                  
            </ItemTemplate>
        </asp:TemplateField>
        
    </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="UserAlertsDataSource" runat="server" SelectCommandType="StoredProcedure"
        ConnectionString="<%$ ConnectionStrings:MLYConnectionString %>" 
        SelectCommand="SCCover_Reports_ShowOpenAlerts"></asp:SqlDataSource> 
    </div>
</asp:Content>
